import axios from "axios"
// 首页顶部分类数据
export const categoryList = () => axios.get("/json/categoryList")
// 首页轮播图
export const slide = () => axios.get("/api/fiora/bannerindex/query/platform")
// 首页活动图标列表
export const activityList = () => axios.get(" /api/cappuccino/icon_set?platform=2&type=1&version=3")
// 首页商品列表数据
export const productList = (page) => axios.get("/v5/goods", {
    params: {
        page: page,
        size: "20"
    }
})
// 分类商品列表
export const cateproductList = (opt_id, opt_type, size, offset) => axios.get(`/operation/${opt_id}/groups`, {
    params: {
        opt_type,
        size,
        offset,
        sort_type: "DEFAULT"

    }
})
// 推荐页面商品列表
export const recproductList = (count, offset) => axios.get("/api/barrow/query", {
    params: {
        app_name: "rectab_gyl",
        list_id: "goods_pBnrJM",
        count: count,
        offset: offset
    }
})


// 搜索页面 分类列表
export const searchCategories = () => axios.get("/json/searchCategories")

// 搜索页面 热门搜索标签
export const searchHotquery = () => axios.get("/search_hotquery?pdduid=5533204118409")

// 搜索页面 搜索输入框返回列表
export const searchSuggest = (query) => axios.get("/search_suggest", {
    params: {
        query,
        pdduid: "5533204118409"
    }
})

// 搜索页面 搜索结果页商品列表
export const searchResult = () => axios.get("/json/searchResult")


// 商品详情页 单个商品详情
export const goodsInfo = () => axios.get("/json/goods")

// 商品详情页 商品服务说明
export const goodsService = () => axios.get(`/json/goodsService`)

// 商品详情页 店铺推荐商品 相似商品
export const mallList = (goods_id) => axios.get("/recommendation", {
    params: {
        goods_id,
        referrer: "goods_with_mall_rec",
        with_mall_rec: "1"
    }
})

// 商品详情页 店铺信息
export const mallInfo = (mall_id) => axios.get(`/mall/${mall_id}/info`)


// 用户地址列表
export const addressList = () => axios.get("/json/addressList")

// 用户订单列表
export const orderList = () => axios.get("/json/orders")

// 用户推荐优惠券列表
export const getcouponsList = () => axios.get("/json/couponsList")

// 用户未使用优惠券
export const getunused = () => axios.get("/json/unused")

// 用户已过期优惠券
export const getoverdue = () => axios.get("/json/overdue")

// 用户浏览足迹
export const getfootprint = () => axios.get("/json/footprint")

// 用户收藏商品列表
export const getgoodsLikes = () => axios.get("/json/goodsLikes")

// 用户收藏店铺列表
export const mallCollection = () => axios.get("/json/mallCollection")


// 获取手机登录验证码
export const getCode = (userPhone) => axios
    .post("/pinduoduo/user/getCode", {
        userPhone: userPhone
    })

// 用户手机登录
export const phoneLogin = (userPhone, code) => axios
    .post("/pinduoduo/user/phoneLogin", {
        userPhone: userPhone,
        userPassword: code
    })
